<template>
  <div>
    <el-card class="visit-main">
      <div class="operater-bar">
        <!--输入和选择区域-->
        <div class="input-select-field">
          <div>
            <el-text class="mx-1">时间：</el-text>
            <el-date-picker
              v-model="value1"
              type="date"
              placeholder="请选择时间"
              :size="size"
            />
          </div>
          <div>
            <el-text class="mx-1">状态：</el-text>
            <el-select placeholder="请选择状态" size="normal">
              <el-option
                v-for="item in bindingStatusOptions"
                :key="item.value"
                :label="item.label"
                :value="item.value"
              />
            </el-select>
          </div>
        </div>
        <!--按钮区域-->
        <div class="btn-field">
          <el-button type="primary">搜索</el-button>
          <el-button type="primary" @click="dialogVisible = true"
            >新增</el-button
          >
        </div>
      </div>
      <div class="table-field">
        <el-table :data="tableData" border stripe style="width: 100%">
          <el-table-column prop="ID" label="ID" />
          <el-table-column prop="name" label="姓名" />
          <el-table-column prop="phone" label="联系电话" />
          <el-table-column prop="cometime" label="探望时间" />
          <el-table-column prop="people" label="探望人员" />
          <el-table-column prop="state" label="状态"> </el-table-column>
        </el-table>
      </div>
    </el-card>
  </div>
  <div>
    <el-dialog
      v-model="dialogVisible"
      title="外出登记"
      width="500"
      :before-close="handleClose"
      center
    >
      <el-card class="dia">
        <div class="dia">
          <el-form :model="form" label-width="auto" style="max-width: 500px">
            <el-form-item label="老人姓名：">
              <el-input v-model="form.name" class="inp" />
            </el-form-item>
            <el-form-item label="联系电话：">
              <el-input v-model="form.phone" class="inp" />
            </el-form-item>
            <el-form-item label="探望时间：">
              <el-date-picker
                v-model="form.time"
                type="datetime"
                placeholder="请选择探望时间："
                class="inp"
              />
            </el-form-item>
            <el-form-item label="探望人员；">
              <el-input v-model="form.fpeople" class="inp" />
            </el-form-item>
          </el-form>
        </div>
        <div class="dia-bt">
          <el-button type="primary" class="bu2">提交</el-button>
          <el-button type="primary" class="bu2" @click="dialogVisible = false"
            >取消</el-button
          >
        </div></el-card
      >
    </el-dialog>
  </div>
</template>

<script setup>
import { ref, reactive } from "vue";
const dialogVisible = ref(false);
const form = reactive({
  name: "",
  phone: "",
  time: "",
  fpeople: "",
});
const tableData = [
  {
    ID: 1,
    name: "张三",
    phone: "13800138000",
    cometime: "2024/5/3/7:33",
    people: "张一",
    state: "已通过",
  },
  {
    ID: 2,
    name: "李四",
    phone: "13900139000",
    cometime: "2024/5/3/7:33",
    people: "李一",
    state: "未审批",
  },
  {
    ID: 3,
    name: "王五",
    phone: "13700137000",
    cometime: "2024/5/3/7:33",
    people: "王一",
    state: "未通过",
  },
];

const bindingStatusOptions = [
  {
    value: 0,
    label: "未审批",
  },
  {
    value: 1,
    label: "已通过",
  },
  {
    value: 3,
    label: "未通过",
  },
];
</script>

<style lang="less" scoped>
.el-breadcrumb {
  margin-bottom: 15px;
}

.visit-main {
  width: 1175px;
  height: 575px;
}

.operater-bar {
  width: 100%;
  flex-direction: row;
  display: flex;
}

.input-select-field {
  display: flex;
  flex-direction: row;
  justify-content: space-evenly;
  align-items: center;
  width: 750px;
}

.table-field {
  width: 100%;
  margin-top: 15px;
}

.el-input {
  width: 150px;
}

.el-select {
  width: 150px;
}

.btn-field {
  width: 350px;
  display: flex;
  justify-content: flex-end;

  > .el-button {
    margin-left: 10px;
    margin-right: 10px;
  }
}
.dia {
  height: 100%;
  width: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  .inp {
    width: 220px;
  }
  .dia-bt {
    display: flex;
    justify-content: center;
    align-items: center;
    .bu2 {
      margin-top: 15px;
      margin-left: 55px;
      margin-right: 55px;
    }
  }
}
</style>
